package me.boot.sys.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import me.boot.db.mybatis.interceptor.foreign.ForeignKey;
import me.boot.gen.table.annotation.ColumnComment;
import me.boot.web.common.template.entity.BaseLinkEntity;

/**
 * 用户职务表
 * <p>
 * 用户可在不同部门兼职，相应有不同职位与职级
 * </p>
 */
@Getter
@Setter
@ApiModel("用户职务表")
@TableName(autoResultMap = true)
public class SysDepartmentUserLink extends BaseLinkEntity<SysDepartment, SysUser> {

    @ForeignKey(SysDepartment.class)
    @ColumnComment("部门id")
    @ApiModelProperty(value = "部门id")
    @TableField
    private Long departmentId;

    @ForeignKey(SysUser.class)
    @ColumnComment("用户id")
    @ApiModelProperty(value = "用户id")
    @TableField
    private Long userId;

    @ForeignKey(SysDicItem.class)
    @ColumnComment("职位id")
    @ApiModelProperty(value = "职位id")
    @TableField
    private Long dicJobPostId;

    @ForeignKey(SysDicItem.class)
    @ColumnComment("职级id")
    @ApiModelProperty(value = "职级id")
    @TableField
    private Long dicJobLevelId;

    @ColumnComment("是否主职")
    @ApiModelProperty(value = "是否主职")
    @TableField
    private boolean isMajor;

    @Override
    protected Long getLeftId() {
        return departmentId;
    }

    @Override
    protected Long getRightId() {
        return userId;
    }
}
